AUTO-763 fix smoother accel decel#19
Merged
doisyg merged 2 commits intobackport_nav_smoother_timeoutfrom Apr 11, 2023
Merged
Conversation
scheunemann
approved these changes
Apr 11, 2023
Comment on lines
+206
to
+223
| double v_component_max; | ||
| double v_component_min; | ||
|
|
||
| // Accelerating if magnitude of v_cmd is above magnitude of v_curr | ||
| // and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | ||
| // Deccelerating otherwise | ||
| if (v_curr * v_cmd >= 0.0) { | ||
| if (abs(v_cmd) >= abs(v_curr)) { | ||
| v_component_max = accel / smoothing_frequency_; | ||
| v_component_min = -accel / smoothing_frequency_; | ||
| } else { | ||
| v_component_max = -decel / smoothing_frequency_; | ||
| v_component_min = decel / smoothing_frequency_; | ||
| } | ||
| } else { | ||
| v_component_max = -decel / smoothing_frequency_; | ||
| v_component_min = decel / smoothing_frequency_; | ||
| } |
There was a problem hiding this comment.
Suggested change
| double v_component_max; | |
| double v_component_min; | |
| // Accelerating if magnitude of v_cmd is above magnitude of v_curr | |
| // and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | |
| // Deccelerating otherwise | |
| if (v_curr * v_cmd >= 0.0) { | |
| if (abs(v_cmd) >= abs(v_curr)) { | |
| v_component_max = accel / smoothing_frequency_; | |
| v_component_min = -accel / smoothing_frequency_; | |
| } else { | |
| v_component_max = -decel / smoothing_frequency_; | |
| v_component_min = decel / smoothing_frequency_; | |
| } | |
| } else { | |
| v_component_max = -decel / smoothing_frequency_; | |
| v_component_min = decel / smoothing_frequency_; | |
| } | |
| double v_component_max = -decel / smoothing_frequency_; | |
| double v_component_min = decel / smoothing_frequency_; | |
| // Accelerating if magnitude of v_cmd is above magnitude of v_curr | |
| // and if v_cmd and v_curr have the same sign (i.e. speed is NOT passing through 0.0) | |
| // Deccelerating otherwise | |
| if (v_curr * v_cmd >= 0.0 && abs(v_cmd) >= abs(v_curr)) { | |
| v_component_max = accel / smoothing_frequency_; | |
| v_component_min = -accel / smoothing_frequency_; | |
| } |
Above reads a little better for me as it shows there is one well defined case to ever accelerate at a glance.
Author
There was a problem hiding this comment.
Reads better but less efficient, v_component_max / v_component_min are computed twice ~50% of the time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of ros-navigation#3529
To test:
ros2 launch arri_bringup twist_pipeline.launch.pyedited with (low max linear accel):
Generate twist on
/cmd_vel_protectedwith:ros2 run rqt_robot_steering rqt_robot_steeringObserve output with plotjuggler (test config: smoother_test.zip )
